CC:=gcc
CFLAGS:= -g -O0 -Wall
log:= third/log.c third/log.h
json:=third/cJSON.c third/cJSON.h
comm:=app/app_common.c app/app_common.h app/app_message.c app/app_message.h

test_log:test/test_log.c $(log)
	-$(CC) $(CFLAGS) -o $@ $^ -Ithird
	-./$@
	rm -f $@

test_json:test/test_json.c $(json)
	-$(CC) $(CFLAGS) -o $@ $^ -Ithird
	-./$@
	rm -f $@

test_time:test/test_time.c $(comm) $(log) $(json)
	-$(CC) $(CFLAGS) -o $@ $^ -Iapp -Ithird
	-./$@
	rm -f $@

mqtt:= app/app_mqtt.c app/app_mqtt.h
test_mqtt:test/test_mqtt.c $(mqtt) $(log)
	-$(CC) $(CFLAGS) -o $@ $^ -Iapp -Ithird -lpaho-mqtt3c
	-./$@
	rm -f $@
